<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Admin\Controller;
use Org\Util\Sync;
/**
 * 同步控制器
 */
class SyncController extends AdminController{
   
    /**
     * 上推
     */
    public function push(){
        $className    =  I('className');
        $sync = new Sync();
        $result = $sync->push($className);
    }
    
    /**
     * 下拉
     */
    public function pull(){
        $className    =  I('className');
        $sync = new Sync();
        $sync->pull($className);
    }
    
    public function test(){
//        $t = microtime(true);
//        dump(date(DATE_ISO86011, $t));
        //dump(mktime("Y-m-dTH:i:s.Z", $t));
//        $t = microtime(true);
//        $micro = sprintf("%03d",($t - floor($t)) * 1000);
//        $d = date('Y-m-d',$t).'T'.date('H:i:s',$t).'.'.$micro.'Z';
//        
//        dump($d);
//        
        //dump(D('Product')->select());
        
        //print $d->format("Y-m-d H:i:s u");
        
        //$rest = new \Org\Util\Rest();
        //$result = $rest->post('https://api.leancloud.cn/1.1/classes/Test', '{"objectId":"1337","name":{"__type":"string","value":"Sean Plott"},"pid":{"__type": "Pointer","className": "Product", "objectId": "8"}}');
    
        D('ProductLeanCloud')->push();
        
        //dump($result);
        
    }
    
}